<?php

class IndexAction extends Action {

	public function index(){

	if($_GET['loginout']==1){
		session(null);
		
	}

		$this->display();
	}
	
	public function checkLogin(){
		session_start();
		$rs=D('Admin/Admin')->get_admin($_POST['username']);
		if($rs){
			if($rs['admin_pwd']==$_POST['pwd']){
				$_SESSION['id']= $rs['admin_id'];
				$_SESSION['cid']= $rs['admin_cid'];
				if($_SESSION['cid'] == 0)
					$this->success('登陆成功!',__APP__.'/Admin/Company');
				else
					$this->success('登陆成功',__APP__.'/Company/Audience');
			}else{
				$this->error('密码错误!');
			}
		}else{
			$this->error('用户名不存在!');
		}
	}
}